//
//  XTXEditCell.m
//  SearchHistory
//
//  Created by 植梧培 on 15/8/25.
//  Copyright (c) 2015年 机智的新手. All rights reserved.
//

#import "XTXEditCell.h"


#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
@interface XTXEditCell ()
@property (weak, nonatomic) IBOutlet UILabel *tipLabel;

@end
@implementation XTXEditCell

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    self.clipsToBounds = YES;
    self.layer.cornerRadius = 12*SCREEN_WIDTH/414 / 2;
    self.layer.borderWidth = 1;
    self.layer.borderColor = XZColor(200,200,200).CGColor;
}

- (void)setKeyword:(NSString *)keyword {
    _keyword = keyword;
    _tipLabel.text = _keyword;
    _tipLabel.textColor = XZColor(200,200,200);
    _tipLabel.font = [UIFont systemFontOfSize:iOS_frame_width(30)];
    [self layoutIfNeeded];
    [self updateConstraintsIfNeeded];
}

- (CGSize)sizeForCell {
    //宽度加 heightForCell 为了两边圆角。
    return CGSizeMake([_tipLabel sizeThatFits:CGSizeMake(MAXFLOAT, MAXFLOAT)].width + 10*SCREEN_WIDTH/414, 30*SCREEN_WIDTH/414);
}

@end
